package com.reremouse.rerebbs.model;

import net.sourceforge.pinyin4j.PinyinHelper;

import javax.persistence.*;
import java.util.Date;
import java.util.List;

@Entity
@Table(name = "rerebbs_client_file")
public class BbsFileModel
        implements Comparable {
    @Id
    @Column(name = "id", unique = true, nullable = false)
    long id = System.nanoTime();
    @Column(name = "fileName")
    String fileName = "";
    @Column(name = "fileAbstract")
    String fileAbstract;
    @Column(name = "fileExt")
    String fileExt;
    @Column(name = "fileSize")
    String fileSize;
    @Column(name = "fileFullPath")
    String fileFullPath;
    @Column(name = "secretGrade")
    String secretGrade;
    @Temporal(TemporalType.TIMESTAMP)
    @Column(name = "uploadTime", length = 0)
    Date uploadTime = new Date();
    @Column(name = "ifFolder")
    Boolean ifFolder;
    @Column(name = "file_scope")
    String scope;
    @Column(name = "fatherID")
    long fatherID;
    @Column(name = "user_id")
    long user_id;
    @Transient
    BbsUser user;
    @Column(name = "realLength")
    long realLength;
    @Column(name = "ancestors")
    String ancestors;
    @Transient
    int sonNum = 0;
    @Transient
    boolean selected = false;
    @Transient
    List<BbsFileModel> familyTree;
    @Transient
    String sharedUserStr;
    @Transient
    String pinyin;

    public long getId() {
        return this.id;
    }

    public void setId(long id) {
        this.id = id;
    }

    public String getFileName() {
        return this.fileName;
    }

    public void setFileName(String fileName) {
        this.fileName = fileName;
    }

    public String getFileAbstract() {
        return this.fileAbstract;
    }

    public void setFileAbstract(String fileAbstract) {
        this.fileAbstract = fileAbstract;
    }

    public String getFileExt() {
        return this.fileExt;
    }

    public void setFileExt(String fileExt) {
        this.fileExt = fileExt;
    }

    public String getFileSize() {
        return this.fileSize;
    }

    public void setFileSize(String fileSize) {
        this.fileSize = fileSize;
    }

    public String getSecretGrade() {
        return this.secretGrade;
    }

    public void setSecretGrade(String secretGrade) {
        this.secretGrade = secretGrade;
    }

    public Date getUploadTime() {
        return this.uploadTime;
    }

    public void setUploadTime(Date uploadTime) {
        this.uploadTime = uploadTime;
    }

    public BbsUser getUser() {
        return this.user;
    }

    public void setUser(BbsUser user) {
        this.user = user;
    }

    public String getFileFullPath() {
        return this.fileFullPath;
    }

    public void setFileFullPath(String fileFullPath) {
        this.fileFullPath = fileFullPath;
    }

    public long getRealLength() {
        return this.realLength;
    }

    public void setRealLength(long realLength) {
        this.realLength = realLength;
    }

    public Boolean getIfFolder() {
        return this.ifFolder;
    }

    public void setIfFolder(Boolean ifFolder) {
        this.ifFolder = ifFolder;
    }

    public long getFatherID() {
        return this.fatherID;
    }

    public void setFatherID(long fatherID) {
        this.fatherID = fatherID;
    }

    public String getScope() {
        return this.scope;
    }

    public void setScope(String scope) {
        this.scope = scope;
    }

    public int getSonNum() {
        return this.sonNum;
    }

    public void setSonNum(int sonNum) {
        this.sonNum = sonNum;
    }

    public boolean isSelected() {
        return this.selected;
    }

    public void setSelected(boolean selected) {
        this.selected = selected;
    }

    public List<BbsFileModel> getFamilyTree() {
        return this.familyTree;
    }

    public void setFamilyTree(List<BbsFileModel> familyTree) {
        this.familyTree = familyTree;
    }

    public String getAncestors() {
        return this.ancestors;
    }

    public void setAncestors(String ancestors) {
        this.ancestors = ancestors;
    }

    public long getUser_id() {
        return this.user_id;
    }

    public void setUser_id(long user_id) {
        this.user_id = user_id;
    }

    public String getPinyin() {
        String fn = new String(this.fileName);
        fn = fn.toLowerCase();
        if (!"".equals(fn)) {
            char a = fn.toLowerCase().charAt(0);
            if (((a > '/') && (a < ':')) || ((a > '`') && (a < '{'))) {
                this.pinyin = fn;
                return this.pinyin;
            }
            String[] ps = PinyinHelper.toHanyuPinyinStringArray(a);
            if (ps != null) {
                this.pinyin = ps[0].substring(0, ps[0].length() - 1);
                return this.pinyin;
            }
            return fn;
        }
        return fn;
    }

    public void setPinyin(String pinyin) {
        this.pinyin = pinyin;
    }

    public int compareTo(Object o) {
        BbsFileModel t = (BbsFileModel) o;
        long i = getUploadTime().getTime() - t.getUploadTime().getTime();
        if (i > 0L) {
            return 1;
        }
        return -1;
    }
}



/* Location:           F:\jsp源码\蝙蝠论坛系统\rerebbs\WEB-INF\classes\

 * Qualified Name:     com.reremouse.rerebbs.model.BbsFileModel

 * JD-Core Version:    0.7.0.1

 */